package com.report.reportserver.service.impl;

import com.report.reportserver.service.ExportExcelService;
import com.report.reportserver.utils.ExportExcelUtil;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ ClassName: ExportExcelServiceImpl
 * @ Description：数据导出Excel服务
 * @ Modified By：
 * @ Version:
 * @ Author     ：LiYing
 * @ Date       ：Created in 13:23 2022/4/21
 */

@Service
public class ExportExcelServiceImpl implements ExportExcelService {

    @Override
    /*
     *
     * @param titleKeyList 表格列名
     * @param titleMap 列名和别名的对应
     * @param src_list 数据集合
     * @return void
     * @author LiYing
     * @creed: Talk is cheap,show me the code
     * @date 2022/4/21 13:25
     */
    public void exportDataToExcel(ArrayList<String> titleKeyList, List<Map<String, Object>> src_list, String tableName, HttpServletResponse response) {
        try {
            ExportExcelUtil.exportDataExcel(titleKeyList, src_list, tableName,response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
